<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <meta charset="utf-8">
    <title>在线用户</title>
</head>
<body>

    当前在线人数为： ${count} 人

    <table width="800px" border="1" cellspacing="0">
        <tr>
            <th>编号</th>
            <th>用户名</th>
            <th>上线时间</th>
            <th>最后一次访问时间</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${accounts}" var="map" varStatus="status">
            <tr>
                <td>${status.count}</td>
                <td>${empty map.value.getAttribute("account").username? '匿名用户': map.value.getAttribute("account").username}</td>
                <td>
                    <jsp:useBean id="dateValue" class="java.util.Date"/>

                    <jsp:setProperty name="dateValue" property="time" value="${map.value.creationTime}"/>

                    <fmt:formatDate  value="${dateValue}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                </td>
                <td>

                    <jsp:setProperty name="dateValue" property="time" value="${map.value.lastAccessedTime}"/>

                    <fmt:formatDate  value="${dateValue}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>

                </td>
                <td><a href="outline?id=${map.key}">下线</a></td>
            </tr>
        </c:forEach>
    </table>



</body>
</html>
